namespace Collaboris.Saf.Actions.Wss.Tests.Generated
{
    using System.IO;

    using Engine.Report;

    using Microsoft.SharePoint;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Saf.Tests;

    using SharePoint.Wss.Lists;

    using Wss.ContentMigration;

    using SharePoint.Wss.ContentMigration;
    using TestHelper = Collaboris.Saf.Actions.Wss.Tests.TestHelper;


    /// <summary>
    /// This test was originally generated but has now been tested and verfiied by MJ
    /// </summary
    [TestClass]
    public class ImportListItemTest
    {

        [TestMethod]
        public void ImportListItem_Test()
        {
            WSSTestAssistant<ImportListItem, ListItemImportSettings> importlistitem =
                    new WSSTestAssistant<ImportListItem, ListItemImportSettings>(TestEnvironment.PublishingSite, 
                        "ImportListItemTestWeb", "BLANKINTERNET#0");

            using (importlistitem)
            {
                string filename = Path.Combine(
                 importlistitem.FirstEntity.ImportSettings.FileLocation,
                 importlistitem.FirstEntity.ImportSettings.BaseFileName);

                // create a person list but dont chuck any data inside it
                TestHelper.CreateTasksList(importlistitem.TestWeb, true, false);


                // this doesn't get tested in isolation...
                // the ExportList_Test created it and actually calls this test directly.
                if (System.IO.File.Exists(filename))
                {
                    MacroReport doReport = importlistitem.DoMacro();

                    Assert.IsNotNull(SPListHelper.GetList(importlistitem.TestWeb, importlistitem.FirstEntity.ListName));
                }

                SPList list = SPListHelper.GetList(importlistitem.TestWeb, "TestTasks", true);
                SPListItem item = list.Items[0];
                Assert.IsTrue((string)item["Description"] == "some desc");
                Assert.IsTrue((string)item["Title"] == "Created for testing");
                

            }
        }

    }
}
